<?php
	include "../include/common.inc.php";

	$user = getLoginUser();
	
	if($user->getValue("id") == -1)
		goToUrl("login.php");
	
	if($user->getValue("type") != 1 )
		die("You are not admin!");
	

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Blind Dating</title>
	<link rel="stylesheet" type="text/css" href="main.css">
  <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>

<nav class="navbar navbar-default " role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.php">NUS Blind Dating Site Admin Control Panel</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav" >
        	<li><a href="users.php">Users</a></li>
        <li><a href="groups.php">Groups</a></li>
        <li><a href="stats.php">Statistic</a></li>
        <li><a href="logout.php">Logout</a></li>
		</ul>
	</div>
	</div>
	</nav>
<div id="main">
<center>
<h2>Welcome Adminstrator: <?php echo $user->getValue("userName"); ?></h2>
</center>
 <?php if($user->getValue("id") != -1) {?>
  <?php  
	list($tmp, $nUsers) = User::getUsers();
	list($tmp, $nGroups) = Group::getGroups();
	list($tmp, $nPosts) = Post::getPosts();
	
?>
    <h4><center>Currently we have <?php echo $nUsers; ?> users, <?php echo $nGroups; ?> groups and <?php echo $nPosts; ?> posts.</center></h4>
	<?php }?>
	
</div>

</body>
</html>